package com.atguigu.security.custom;

/**
 * className: LoginUserInfoHelper
 * description:
 * date: 2023/4/23 0023-21:42
 * <p>
 * project: guigu-oa-parent
 * package: com.atguigu.security.custom
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
public final class LoginUserInfoHelper {
    private static final ThreadLocal<Long> USER_ID = new ThreadLocal<>();
    private static final ThreadLocal<String> USERNAME = new ThreadLocal<>();

    public static void setUserId(Long userId) {
        USER_ID.set(userId);
    }

    public static Long getUserId() {
        return USER_ID.get();
    }

    public static void removeUserId() {
        USER_ID.remove();
    }

    public static void setUsername(String username) {
        USERNAME.set(username);
    }

    public static String getUsername() {
        return USERNAME.get();
    }

    public static void removeUsername() {
        USERNAME.remove();
    }
}
